<!DOCTYPE html>
<html>
<head lang="en">
<meta charset="UTF-8">
<title>用户登录</title>
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=no">
<meta name="format-detection" content="telephone=no">
<meta name="renderer" content="webkit">
<meta http-equiv="Cache-Control" content="no-siteapp" />
<link rel="alternate icon" type="image/png" href="assets/i/favicon.png">
<link rel="stylesheet" href="assets/css/amazeui.min.css" />
<style>
.header {
	text-align: center;
}

.header h1 {
	font-size: 200%;
	color: #333;
	margin-top: 30px;
}

.header p {
	font-size: 14px;
}
</style>
</head>
<body>
	<div class="header">
		<div class="am-g">
			<h1>大象与猩猩</h1>

		</div>
		<hr />
	</div>
	<div class="am-g">
		<div class="am-u-lg-6 am-u-md-8 am-u-sm-centered">
			<form class="am-form" id="submitForm">
				<div class="am-form-group am-form-icon">
					<i class="am-icon-user"></i><input type="tel" name="phone" id="phone" class="am-form-field"  placeholder="请输入手机号">
				</div>
				<div class="am-form-group am-form-icon">
					<i class="am-icon-lock"></i><input type="password" class="am-form-field" name="password" id="password" placeholder="请输入密码">
				</div>
				<input id="login" type="submit" name="" value="登 录" class="am-btn am-btn-primary am-u-sm-12"> <br /> <br />
				<div class="am-cf am-margin-top-xs">
					<a href="wechat-getback.html" id="forgetPassword" class="am-btn am-btn-default am-btn-sm am-fl">忘记密码</a> <a href="wechat-register.html" id="" class="am-btn am-btn-default  am-btn-sm am-fr">立即注册</a>
				</div>
			</form>
			<hr>
			<p>© 2014-2016 dxyxx, Inc. 浙ICP备14017672号</p>
		</div>
	</div>
	<script src="../resources/js/zepto1.1.6.min.js"></script>
	<script type="text/javascript">
		$("#submitForm").submit(function submitPWD() {
			event.preventDefault();
			$.ajax({
				type : "GET",
				url : "../encryption/transfer?plain=" + $('#password').val(),
				success : function(data) {
					console.log(data);
					if (data.code == 1) {
						//$('#password').attr('value',data.object);
						$('#password').val(data.object);
						$.ajax({
							type : "POST",
							url : "../login",
							data : $("#submitForm").serialize(),
							success : function(data) {
								console.log(data);
								if (data.code == 1) {
									backUri = encodeURIComponent("https://rs88881234.com/chinesejie/weixin/bind");
									// 

									url = "https://open.weixin.qq.com/connect/oauth2/authorize?appid=wx1d8e9a967a8c62bd&redirect_uri=" + backUri + "&response_type=code&scope=snsapi_base&state=123#wechat_redirect";

									//window.location.replace(url);//微信上使用 好像有问题
									window.location.href = url;
								} else {
									alert(data.info);
									$('#password').val("");
								}
							},
							error : function(data) {
							}
						});

					} else {
						alert(data.info);
					}
				},
				error : function(data) {
				}
			});

		});
	</script>

</body>
</html>